package com.inifitness.admin.core.system.converter;


import com.inifitness.admin.core.system.model.entity.SysDept;
import com.inifitness.admin.core.system.model.form.DeptForm;
import com.inifitness.admin.core.system.model.vo.DeptVO;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 部门对象转换器
 *
 * @author sunjinfeng
 * @since 2024/04/18 11:00:00
 */
@Mapper(componentModel = "spring")
public interface DeptConverter {

  DeptForm entity2Form(SysDept entity);

  @Mapping(target = "children", ignore = true)
  DeptVO entity2Vo(SysDept entity);

  @Mapping(target = "updateTime", ignore = true)
  @Mapping(target = "updateBy", ignore = true)
  @Mapping(target = "treePath", ignore = true)
  @Mapping(target = "deleted", ignore = true, defaultValue = "0")
  @Mapping(target = "createTime", ignore = true)
  @Mapping(target = "createBy", ignore = true)
  SysDept form2Entity(DeptForm deptForm);
}